<?php
$companyid=$session->read("companyid");
$user=$session->read('User');
$userid=$user['id'];
$usertype=$action->checkPermissions($user,"utype");
$isflag=$action->checkPermissions($user,"confirm");
//print_r($isflag);
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
	<?php
	//if($user['usertype']!='2' && $user['usertype']!='3')
	if($usertype&&classregistry::init('User')->personAuthority($user)){
		echo '<div class="right item_add_btn">';
		echo $html->link(__('添加',true), 'edittalent');
		echo '</div>';
	}else{
		echo '<div class="right enableaction">';
		echo "<a>添加</a>";
		echo '</div>';
	}
	?>
	<?php
	if($showpage==1)
	{
		if(isset($paging)){ echo $this->renderElement('pagination',$paging);}
	}
	?>
	<div class="clear"></div>
	<?php if(1==11){?>
	<div class="right_sidt_head_screen">
		<div class="left">
			<div class="right_side_head_line">
				<ul>
					<li style="width: auto">
						<div class="left screen_condition">
						<?php echo $html->link("总数","/companys/talent")?>
							：
						</div>
						<div class="left screen_counts">
						<?php echo $talentcount?>
							人
						</div>
						<div class="clear"></div>
					</li>
					<?php
					foreach($declaretypecount as $declaretype){
						$selected="";
						if(!empty($_GET['declaretype'])){
							if($declaretype["key"]==$_GET['declaretype']){
								$selected="selected";
							}
						}
						?>
					<li class="<?php echo $selected?>" style="width: auto">
						<div class="left screen_condition">
						<?php echo $html->link($declaretype["name"],"/companys/talent?declaretype=".$declaretype["key"])?>
							：
						</div>
						<div class="left screen_counts">
						<?php echo $declaretype["count"]?>
							个
						</div>
						<div class="clear"></div>
					</li>
					<?php }?>
					<div class="clear"></div>
				</ul>
			</div>
		</div>
		<div class="right display_by_year_btn">
		<?php echo $html->link('按年度显示',"/companys/timetalent/",null,null); ?>
		</div>
		<div class="clear"></div>
	</div>
	<?php }?>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="items_list" id='panel'>
			<table>
				<tr>
					<th>项目名称</th>
					<th>申报类型</th>
					<th>主管部门</th>
					<!--                    <th>申报状态</th>-->
					<th>申报时间</th>
					<th><?php __("Action")?></th>
				</tr>
				<?php
				foreach($talents as $talent){
					$id=$talent["CompTalent"]["id"];
					echo "<tr class='per_list'>";
					$creater=$talent['CompTalent']['creater'];
					$name=$talent['CompTalent']['declare_name'];
					echo "<td>".$html->link($name,"/companys/showtalent/".$id,null,null)."</td>";
					$tvalue=$talent['CompTalent']['type_id'];
					classregistry::init('Talstack')->tname="";
					classregistry::init('Talstack')->showtname($tvalue);
					$tname=rtrim(classregistry::init('Talstack')->tname,"/");
					echo "<td>".$tname."</td>";
					classregistry::init('Talstack')->tname="";
					echo "<td>".$str->getkeystr($talent['Talstack']['gov'],$talstacktype)."</td>";
					//					echo "<td>".$str->getkeystr($talent['CompTalent']['declarate_status'],$dstatus)."</td>";
					echo "<td>".date("Y-m-d",strtotime($talent['CompTalent']['declare_time']))."</td>";
					echo "<td>";
						$company=classregistry::init('Company')->findById($companyid);
					if((($userid==$creater)||($isflag))&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($company)){
						echo $html->link(__("Edit",true),"/companys/edittalent/".$id,null,null);
					}else{
						echo "<span class='enableaction'>编辑</span>";
					}
					if((($userid==$creater)||($isflag))&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($company)){
						echo $html->link(__("Delete",true),"/companys/deltalent/".$id,array("onclick"=>"return doaction(this)"));
					}else{
						echo "<span class='enableaction'>删除</span>";
					}
					echo "</td>";
					echo "</tr>";
				}?>
			</table>
		</div>
	</div>
</div>
				<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>